package com.library.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 前台，转发到各种进入系统后的UI页面
 * Created by linzhi on 2016/12/12.
 */
@Controller
@RequestMapping("/home")
public class HomeController {

    /**
     * 首页（投票榜）
     */
    @RequestMapping("/indexUI")
    public String indexUI() {
        return "home/index";
    }
    /**
     * 荐书历史
     */
    @RequestMapping("/historyUI")
    public String historyUI() {
        return "home/history";
    }
    /**
     * 我要荐书
     */
    @RequestMapping("/addUI")
    public String addUI() {
        return "home/add";
    }
    /**
     * 搜索
     */
    @RequestMapping("/searchUI")
    public String searchUI(String searchStr, HttpServletRequest request) {
        //防止js中'${searchStr}'当为'content'conent'时出错
        request.setAttribute("searchStr", searchStr.replace("'", "\\'"));
        return "home/search";
    }
    /**
     * 我的荐书
     */
    @RequestMapping("/myBookUI")
    public String myBookUI() {
        return "home/myBook";
    }
    /**
     * 我的投票
     */
    @RequestMapping("/myVoteUI")
    public String myVoteUI() {
        return "home/myVote";
    }
    /**
     * 预购图书
     */
    @RequestMapping("/booksToBuyUI")
    public String booksToBuyUI() {
        return "home/booksToBuy";
    }
    /**
     * 已购图书
     */
    @RequestMapping("/booksPurchasedUI")
    public String booksPurchasedUI() {
        return "home/booksPurchased";
    }
}
